<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>GadgetAdvanced.pb</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<pre><font face="Courier New, Courier, mono"size="2"><font color="#3A3966">;
</font><font color="#3A3966">; ------------------------------------------------------------
</font><font color="#3A3966">;
</font><font color="#3A3966">;   PureBasic - Gadget example file
</font><font color="#3A3966">;
</font><font color="#3A3966">;    (c) Fantaisie Software
</font><font color="#3A3966">;
</font><font color="#3A3966">; ------------------------------------------------------------
</font><font color="#3A3966">;
</font>
<font color="#924B72">#WindowWidth</font>  = 450
<font color="#924B72">#WindowHeight</font> = 305

<font color="#3A3966">; Load our images..
</font><font color="#3A3966">;
</font><font color="#3A3966">LoadImage</font>(0, <font color="#924B72">#PB_Compiler_Home</font> + "examples/sources/Data/Drive.bmp")
<font color="#3A3966">LoadImage</font>(1, <font color="#924B72">#PB_Compiler_Home</font> + "examples/sources/Data/File.bmp")
<font color="#3A3966">LoadImage</font>(2, <font color="#924B72">#PB_Compiler_Home</font> + "examples/sources/Data/PureBasic.bmp")

<b><font color="#3A3966">CompilerIf</font></b> <font color="#924B72">#PB_Compiler_OS</font> = <font color="#924B72">#PB_OS_Windows</font>
  <font color="#3A3966">; Only Windows supports .ico file format
</font><font color="#3A3966">  LoadImage</font>(3, <font color="#924B72">#PB_Compiler_Home</font> + "examples/sources/Data/CdPlayer.ico")
<b><font color="#3A3966">CompilerElse</font></b>
<font color="#3A3966">  LoadImage</font>(3, <font color="#924B72">#PB_Compiler_Home</font> + "examples/sources/Data/Drive.bmp")
<b><font color="#3A3966">CompilerEndIf</font></b>

<font color="#3A3966">CreatePopupMenu</font>(0)
<font color="#3A3966">  MenuItem</font>(0, "Popup !")

<b><font color="#3A3966">If</font></b> <font color="#3A3966">OpenWindow</font>(0, 100, 200, <font color="#924B72">#WindowWidth</font>, <font color="#924B72">#WindowHeight</font>, "PureBasic - Advanced Gadget Demonstration", <font color="#924B72">#PB_Window_SystemMenu</font> | <font color="#924B72">#PB_Window_MinimizeGadget</font>)

<font color="#3A3966">  ListIconGadget</font>(5, 170, 50, 265, 200, "Column 1", 131)
<font color="#3A3966">  AddGadgetColumn</font>(5, 1, "Column 2", 300)
<font color="#3A3966">  AddGadgetColumn</font>(5, 2, "Column 3", 80)
  
<font color="#3A3966">  TextGadget</font>(4, 10, 16, 180, 24, "Please wait while initializing...")
  
<font color="#3A3966">  ProgressBarGadget</font>(3, 10, 260, <font color="#924B72">#WindowWidth</font>-25, 20, 0, 100)
  
  <font color="#3A3966">; Update the ProgressBar, just for fun !
</font>  <font color="#3A3966">;
</font>  <b><font color="#3A3966">For</font></b> k=0 <b><font color="#3A3966">To</font></b> 100
<font color="#3A3966">    SetGadgetState</font>(3, k)
<font color="#3A3966">    Delay</font>(10)
  <b><font color="#3A3966">Next</font></b>
  
<font color="#3A3966">  ImageGadget      </font>(0, 200, 5, 0, 0,<font color="#3A3966"> ImageID</font>(2))
<font color="#3A3966">  ButtonImageGadget</font>(1, 384, 5, 50, 36,<font color="#3A3966"> ImageID</font>(3))
  
<font color="#3A3966">  TreeGadget    </font>(2,  10, 50, 150, 200)
    
<font color="#3A3966">  SetGadgetText</font>(4, "Initialize Ok... Welcome !")
  
  <font color="#3A3966">; Fill Up the Tree gadget with lot of entries (including the image)
</font>  <font color="#3A3966">;
</font>
  <b><font color="#3A3966">For</font></b> k=0 <b><font color="#3A3966">To</font></b> 10
<font color="#3A3966">    AddGadgetItem</font>(2, -1, "General "+<font color="#3A3966">Str</font>(k),<font color="#3A3966"> ImageID</font>(1))
<font color="#3A3966">    AddGadgetItem</font>(2, -1, "ScreenMode",<font color="#3A3966"> ImageID</font>(1))
<font color="#3A3966">      AddGadgetItem</font>(2, -1, "640*480",<font color="#3A3966"> ImageID</font>(1), 1)
<font color="#3A3966">      AddGadgetItem</font>(2, -1, "800*600",<font color="#3A3966"> ImageID</font>(3), 1)
<font color="#3A3966">      AddGadgetItem</font>(2, -1, "1024*768",<font color="#3A3966"> ImageID</font>(1), 1)
<font color="#3A3966">      AddGadgetItem</font>(2, -1, "1600*1200",<font color="#3A3966"> ImageID</font>(1), 1)
<font color="#3A3966">    AddGadgetItem</font>(2, -1, "Joystick",<font color="#3A3966"> ImageID</font>(1))
  <b><font color="#3A3966">Next</font></b>
    
  <font color="#3A3966">; Fill Up the ListIcon gadget. Notice than the column are separated by Chr(10) (NewLine) character
</font>  <font color="#3A3966">;
</font>  <b><font color="#3A3966">For</font></b> k=0 <b><font color="#3A3966">To</font></b> 100
<font color="#3A3966">    AddGadgetItem</font>(5, -1, "Element "+<font color="#3A3966">Str</font>(k)+<font color="#3A3966">Chr</font>(10)+"C 2"+<font color="#3A3966">Chr</font>(10)+"Comment 3",<font color="#3A3966"> ImageID</font>(3))
  <b><font color="#3A3966">Next</font></b>
  
<font color="#3A3966">  SetGadgetState</font>(5, 8)
  
  <b><font color="#3A3966">Repeat</font></b>
    Event =<font color="#3A3966"> WaitWindowEvent</font>()

    <b><font color="#3A3966">If</font></b> Event = <font color="#924B72">#PB_Event_Gadget</font>
      
      <b><font color="#3A3966">Select</font></b> <font color="#3A3966">EventGadget</font>()
        <b><font color="#3A3966">Case</font></b> 1
<font color="#3A3966">          MessageRequester</font>("Information", "You did it !", 0)
      
        <b><font color="#3A3966">Case</font></b> 2
<font color="#3A3966">          SetGadgetText</font>(4, "Tree Gadget. Item selected: "+<font color="#3A3966">Str</font>(<font color="#3A3966">GetGadgetState</font>(2)))
          
          <b><font color="#3A3966">If</font></b> <font color="#3A3966">EventType</font>() = 2
<font color="#3A3966">            MessageRequester</font>("Information", "Doubleclick: item"+<font color="#3A3966">Str</font>(<font color="#3A3966">GetGadgetState</font>(2))+", Text: "+<font color="#3A3966">GetGadgetText</font>(2), 0)
          <b><font color="#3A3966">ElseIf</font></b> <font color="#3A3966">EventType</font>() = 1
<font color="#3A3966">            DisplayPopupMenu</font>(0,<font color="#3A3966"> WindowID</font>(0))
          <b><font color="#3A3966">EndIf</font></b>
          
        <b><font color="#3A3966">Case</font></b> 5
<font color="#3A3966">          SetGadgetText</font>(4, "ListIcon Gadget. Item selected: "+<font color="#3A3966">Str</font>(<font color="#3A3966">GetGadgetState</font>(5)))
          
          <b><font color="#3A3966">If</font></b> <font color="#3A3966">EventType</font>() = 2
<font color="#3A3966">            MessageRequester</font>("Information", "Doubleclick: item"+<font color="#3A3966">Str</font>(<font color="#3A3966">GetGadgetState</font>(5))+", Text: "+<font color="#3A3966">GetGadgetText</font>(5), 0)
          <b><font color="#3A3966">ElseIf</font></b> <font color="#3A3966">EventType</font>() = 1
<font color="#3A3966">            DisplayPopupMenu</font>(0,<font color="#3A3966"> WindowID</font>(0))
          <b><font color="#3A3966">EndIf</font></b>
          
     <b><font color="#3A3966">EndSelect</font></b>

    <b><font color="#3A3966">EndIf</font></b>
    
  <b><font color="#3A3966">Until</font></b> Event = <font color="#924B72">#PB_Event_CloseWindow</font>
<b><font color="#3A3966">EndIf</font></b>

<b><font color="#3A3966">End</font></b> </font></pre>
</body></html>
